package com.sc.nft.util;

import cn.hutool.crypto.SecureUtil;
import com.sc.nft.enums.RedisKeyEnum;
import lombok.experimental.UtilityClass;

@UtilityClass

public class TokenUtil {




    public String getRedisTokenKey(String token){
        return RedisKeyEnum.USER_INFO.getKey() +token;
    }
    public String getRedisTokenAdminKey(String token){
        return RedisKeyEnum.ADMIN_MEMBER_INFO.getKey()+token;
    }

    public String createToken(Long userId){
        String token=  SecureUtil.sha256(System.currentTimeMillis()+""+userId);
        return token ;
    }

    public String createAdminToken(Long userId){
        String token=  SecureUtil.md5(System.currentTimeMillis()+""+userId);
        return token ;
    }

    public static String getRegisterValidateCode(String userAccount,Integer type) {
        String token=  SecureUtil.md5(userAccount+""+type);
        return token ;
    }
}
